package deepbrain.simnetwork.factory;

import deepbrain.simnetwork.exception.SimNetworkException;
import deepbrain.simnetwork.exception.SimNetworkRuntimeException;
import deepbrain.simnetwork.network.NetworkState;
import deepbrain.simnetwork.network.NodeState;

/**
 * 
 * 
 * @author Li Yang
 * @create 2009-2-25
 */
public class ArrayNetworkStateFactory implements NetworkStateFactory {

	private NodeState[] array;

	public ArrayNetworkStateFactory(NodeState[] array) {
		if (array.length == 0)
			throw new SimNetworkRuntimeException(
					"The length of array given to ArrayNetworkStateFactory is Zero!");
		this.array = array;
	}

	public NetworkState newNetworkState(int numOfNodes)
			throws SimNetworkException {
		return new NetworkState(array);
	}
}
